import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        component: () => import("../views/index.vue")
    },
    {
        path: "/mobile",
        component: () => import("../views/namespace"),
        children: [
            //物品分类列表
            {
                path: 'offices/list',
                component: () => import('../views/office/assortList.vue')
            },
            //物品列表
            {
                path: 'offices/articleList',
                component: () => import('../views/office/articleList.vue')
            },
            //物品申领列表
            {
                path: 'offices/claim',
                component: () => import('../views/namespace.vue'),
                children: [
                    {
                        path: 'articleClaim',
                        component: () => import('../views/office/articleClaim.vue')
                    },
                    {
                        path: 'articleClaimList',
                        component: () => import('../views/office/articleClaimList.vue')
                    }
                ]
            },

        ],

    },
    {
        path: "/hr-mobile",
        component: () => import("../views/namespace"),
        children: [
            //物品分类列表
            {
                path: 'transferList',
                component: () => import('../views/hr/transferList.vue')
            },
            //合同列表
            {
                path: 'contractList',
                component: () => import('../views/hr/contract/contractList.vue')
            },
            //赔付明细
            {
                path: 'payBackList',
                component: () => import('../views/yanqi/payBack/payBackList')
            },
            //赔付明细
            {
                path: 'duifuList',
                component: () => import('../views/yanqi/duifu/duifuList')
            },
            //赔付明细
            {
                path: 'yanfuList',
                component: () => import('../views/yanqi/yanfu/yanfuList')
            },
            //延付台账
            {
                path: 'yanfutaizhang',
                component: () => import('../views/yanqi/yanfutaizhang/yanfutaizhang')
            },
            //工资查询
            {
                path: 'salaryList',
                component: () => import('../views/hr/salary/salaryList')
            },
            //工资详情
            {
                path: 'salaryInfo',
                name: "salaryInfo",
                component: () => import('../views/hr/salary/salaryInfo')
            },
            //请假列表
            {
                path: 'leaveList',
                name: "leaveList",
                component: () => import('../views/hr/qingjia/leaveList')
            },
            //加班列表
            {
                path: 'overTimeList',
                name: "overTimeList",
                component: () => import('../views/hr/overTime/overTimeList')
            },
            //证照列表
            {
                path: 'licenseList',
                name: "licenseList",
                component: () => import('../views/hr/license/licenseList')
            },
            //护照列表
            {
                path: 'passportList',
                name: "passportList",
                component: () => import('../views/hr/passport/passportList')
            },
            //培训列表
            {
                path: 'recordingList',
                name: "recordingList",
                component: () => import('../views/hr/peixun/recordingList')
            },
            //个人档案
            {
                path: 'personalInfo',
                name: "personalInfo",
                component: () => import('../views/hr/personal/personalInfo')
            },
            //请假详情
            {
                path: 'leaveInfo',
                name: "leaveInfo",
                component: () => import('../views/hr/qingjia/leaveInfo')
            },
            //个人工资
            {
                path: 'personalSalary',
                name: "personalSalary",
                component: () => import('../views/hr/salary/personalSalary')
            },
        ]
    },
    {
        path: "/assets-mobile",
        component: () => import("../views/namespace"),
        children: [
            //个人使用设备 维修记录 调拨记录  有多个页面会使用这个页面所以单独拆出来
            {
                path: 'alonePersonInfo',
                component: () => import('../views/assets/common/alonePersonInfo')
            },
            //个人使用设备
            {
                path: 'alonePerson',
                component: () => import('../views/assets/person/alonePerson')
            },
            //个人盘点
            {
                path: 'aloneInventory',
                component: () => import('../views/assets/inventory/Index')
            },
            //扫码盘点
            {
                path: 'inventoryScanner',
                component: () => import('../views/assets/inventory/inventoryScanner')
            },
            //新建盘点
            {
                path: 'newInventory',
                component: () => import('../views/assets/inventory/newInventory')
            },
            // //扫一扫查看的固定资产详情
            // {
            //     path: 'aloneLedger',
            //     component: () => import('../views/assets/ledger/aloneLedger')
            // },
            //扫一扫查看的固定资产详情
            {
                path: 'saoma',
                component: () => import('../views/assets/ledger/saoma')
            },
        ]
    },
    {
        path: '/test',
        component: () => import('../views/test.vue')
    },
    //扫码盘点
    {
        path: '/inventoryScannerMobile',
        component: () => import('../views/assets/inventory/inventoryScanner.vue')
    },
    // {
    //     path: '/touCun',
    //     component: () => import('../views/touCun/CodeScanner.vue')
    // },
];


const router = new VueRouter({
    routes: [
        ...routes
    ]
});

import Watermark from "../uitl/watermark"

router.afterEach((to) => {
    try {
        let user = JSON.parse(localStorage.getItem("$user"));
        Watermark.set(user["trueName"] + ":" + user["id"]);
    } catch (e) {
        Watermark.set(SYSTEM_ENV.sys_name);
    }
});


export default router
